//
//  ThreadEx.m
//  baovn
//
//  Created by Phuong Le on 7/2/13.
//  Copyright (c) 2013. All rights reserved.
//

#import "ThreadEx.h"

@implementation ThreadEx

- (void)start
{
    _status = ThreadRun;
    
    [self loop];
}

- (void)stop
{
    _status = ThreadStop;
}

- (void)pause
{
    _status = ThreadPause;
}

- (void)resume
{
    _status = ThreadRun;
}

- (void)loop
{
//    if (_thread)
//    {
//        return;
//    }
//    
//    _thread = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//    
//    dispatch_async(_thread, ^{
//        while (_status != ThreadStop)
//        {
//            //
//            if (_status == ThreadPause)
//            {
//                NSLog(@"Thread is pausing");
//                [NSThread sleepForTimeInterval:1.0f];
//                
//                continue;
//            }
//            
//            //to do
//            
//        }
//    });
}

- (void)dealloc
{
    [self stop];
    
    _thread = nil;
}
@end
